package edu.yuhf.datedemo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateOperation {

    public void buildDate() throws ParseException {
        Date date =new Date();
        System.out.println(date);
        SimpleDateFormat sdf0 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E z");
        String stringDate = sdf0.format(date);
        System.out.println(stringDate);
        String inputStringDate = "2021-01-11";
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
        Date date0 = sdf1.parse(inputStringDate);
        System.out.println(date0);
    }
}
